/* 根据fid删除 */
/**
 * 所有的参数必须传递
 * @param {string} fid
 * @param {object} service {name,layerId} 
 */
function DelFeature({
    fid,
    service,
    layer
}) {
    /* service必须是对象 name,layerId */
    checkService(service);
    var deleteService = new Zondy.Service.EditDocFeature(service.name, service.layerId, {
        ip: "localhost",
        port: "6163" //访问IGServer的端口号，.net版为6163，Java版为8089
    });
    deleteService.deletes(fid, onSuccess(layer));
}
function onSuccess(layer) {
    return function (result) {
        if (result) {
            alert("删除要素成功！");
            layer.refresh();
        } else {
            alert("删除要素失败！");
        }
    }
}

function checkService(service){
    if(service instanceof Object){
        var keys = Object.keys(service);
        if(keys.includes("name") && keys.includes("layerId")){
            console.log("参数合法")
        }else{
            console.log("参数不合法")
        }
    }else{
        console.log("输入的参数不合法")
    }
}
/* 
1、设置rectangle获取geometry
2、调用Query.queryByGeom获取mapgis的对象 fid
3、调用删除的方法
 */
